import 'package:aichat_flutter_wallet/module_common/widgets/image/public_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter/material.dart'
    hide RefreshIndicator, RefreshIndicatorState;

class AssetsPullRefreshCustomHeader extends RefreshIndicator {
  AssetsPullRefreshCustomHeader()
      : super(height: 50.w, refreshStyle: RefreshStyle.Follow);

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return AssetsPullRefreshCustomState();
  }
}

class AssetsPullRefreshCustomState
    extends RefreshIndicatorState<AssetsPullRefreshCustomHeader> {
  @override
  void initState() {
    // TODO: implement initState
    // init frame is 2

    super.initState();
  }

  // @override
  // void onModeChange(RefreshStatus mode) {
  //   // TODO: implement onModeChange
  //   if (mode == RefreshStatus.refreshing) {
  //     _gifController.repeat(
  //         min: 0, max: 29, period: Duration(milliseconds: 500));
  //   }
  //   super.onModeChange(mode);
  // }

  @override
  void resetValue() {
    // TODO: implement resetValue
    // reset not ok , the plugin need to update lowwer
    super.resetValue();
  }

  @override
  Widget buildContent(BuildContext context, RefreshStatus mode) {
    // TODO: implement buildContent
    return Container(
      child: Stack(
        alignment: Alignment.bottomCenter,
        children: [
          Container(
            height: 80.w,
          ),
          Positioned(
              bottom: 0,
              child: PublicImage(
                image: "assets/images/common/loading2.gif",
                height: 30.w,
                width: 60.w,
              ))
        ],
      ),
    );
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
  }
}
